<script setup>
    const prop =  defineProps({
        car:String,
        changeCarCb:Function
    })
    console.log(prop.car);
    const emit =  defineEmits(['changeCar'])
</script>

<template>
    <div style="width: 300px; height: 200px; border: 10px,solid #ff0000;">
        子组件
        <div>车: {{ car }}</div>
        <button @click="emit('changeCar','玛莎拉蒂')">换车</button>
        <button @click="changeCarCb('奔驰E300')">换车(方式2)</button>
    </div>
</template>

<style scoped>

</style>